package inherit;

/**
 * @Author 12629
 * @Description：
 */
class Base {
    public int a=1;
    public int b=2;

    public void methodA() {
        System.out.println("Base::methodA()");
    }

    public void methodB() {
        System.out.println("Base::methodB()");
    }
}
class Derived extends Base {
    public int a=3;
    public int d=4;

    public void methodA(int val) {
        System.out.println("Base::methodA(int)"+val);
    }

    public void methodB() {
        System.out.println("Derived::methodB()");
    }

    public  void test() {
        methodA();
        methodA(10);
        super.methodB();
        /*System.out.println(this.a);
        System.out.println(this.b);
        System.out.println(this.d);
        System.out.println("访问父类的a: "+super.a);*/
    }
}
public class Test2 {
    public static void main(String[] args) {
        Derived derived = new Derived();
        derived.test();
    }
}
